package uy.edu.um.ltic.commons;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.ArrayList;

public class MessageVO implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Timestamp date;
	private ArrayList<EmployeeVO> receivers;
	private EmployeeVO sender;
	private String text;
	private byte[] data;
	private String name;
	int type;				//1:TextMessage  //2:ConferenceMessage   //3:FileMessage
	Integer idConference;
	
	

	public MessageVO(Timestamp da , ArrayList<EmployeeVO> re, EmployeeVO se, String tex, byte[] dat, String na,int typ,Integer idCon){
		if((typ == 1)&&(dat!=null)&&(re.size()!=1)){
			throw new RuntimeException("Tipo text con datos o mas de un destinatario");
		}
		if((typ == 2)&&(dat!=null)&&(re.size()<=1)){
			throw new RuntimeException("Tipo conferencia con datos o un destinatario");
		}
		if((typ == 3)&&(dat==null)&&(re.size()!=1)){
			throw new RuntimeException("Tipo datos con null o mas de un destinatario");
		}
		
		date = da;
		receivers = re;
		sender = se;
		text = tex;
		data = dat;
		name = na;
		type = typ;
		idConference = idCon;
		
		
	}

	public Timestamp getDate() {
		return date;
	}

	public void setDate(Timestamp date) {
		this.date = date;
	}

	public ArrayList<EmployeeVO> getReceivers() {
		return receivers;
	}

	public void setReceivers(ArrayList<EmployeeVO> receivers) {
		this.receivers = receivers;
	}

	public EmployeeVO getSender() {
		return sender;
	}

	public void setSender(EmployeeVO sender) {
		this.sender = sender;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public byte[] getData() {
		return data;
	}

	public void setData(byte[] data) {
		this.data = data;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}
	
	public int getIdConference() {
		return idConference;
	}

	public void setIdConference(int idConference) {
		this.idConference = idConference;
	}
}
